package cn.lu.joke.ui.dialog;

import android.view.View;
import android.view.WindowManager;
import android.widget.PopupWindow;

import com.github.chrisbanes.photoview.PhotoView;


import butterknife.BindView;
import cn.lu.joke.GlideApp;
import cn.lu.joke.R;
import cn.lu.joke.base.BaseDialogFragment;

public class ImageDialog extends BaseDialogFragment {

    @BindView(R.id.pv_dialog)
    PhotoView mPv;

    private String path;
    private boolean isStorage;
    private PopupWindow mPwSave;

    public void setImagePath(String path, boolean isStorage) {
        this.path = path;
        this.isStorage = isStorage;
    }

    @Override
    public int getLayoutRes() {
        return R.layout.dialog_image;
    }

    @Override
    public void onCreated(View layout) {
        GlideApp.with(layout)
                .asDrawable()
                .load(path)
                .skipMemoryCache(true)
                .into(mPv);
    }

    @Override
    protected void setAttributes(WindowManager.LayoutParams params) {
        params.width = WindowManager.LayoutParams.MATCH_PARENT;
        params.height = WindowManager.LayoutParams.MATCH_PARENT;
        super.setAttributes(params);
    }


}
